package cn.edu.nhic.order.utils;

import com.google.gson.Gson;
import com.google.gson.reflect.TypeToken;

import java.lang.reflect.Type;
import java.util.List;

import cn.edu.nhic.order.bean.ShopBean;


public class JsonParse {
    private static JsonParse instance;

    public JsonParse() {
    }

    public static JsonParse getInstance(){
        if(instance==null){
            instance=new JsonParse();
        }
        return instance;
    }

    public List<ShopBean> getShopList(String json){
        Gson gson=new Gson();
        Type listType=new TypeToken<List<ShopBean>>(){}.getType();
        //把获取到信息集合存到shopList中
        List<ShopBean> shopBeanList=gson.fromJson(json,listType);
        return shopBeanList;
    }
}
